<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    zhu <br>
    账号 <input type="text" id="user" value=""> <br>
    密码 <input type="text" id="pass" value=""> <br>
    <button class="but">注册</button>
</body>

</html>
<script src="./ObjectAjax.js"></script>
<script>

    let ajax = new PublicUser()

    class Login {
        constructor({ $, get, post }) {
            this.$ = $
            this.get = get
            this.post = post
            this.init()//入口文件
        }
        init() {

            let thas = this

            this.$(".but").onclick = e => {
                console.log(thas.$("#user").value);
                console.log(thas.$("#pass").value);
                thas.post({
                    url: "/zhu",
                    text: {
                        user: thas.$("#user").value,
                        pass: thas.$("#pass").value
                    },
                 
                    callback(str) {
                        console.log(str);
                        if (str === "001") {
                            // location.href= "http://localhost:3000/hom.html"                        
                        }

                    }
                })
            }
        }
    }
    new Login(ajax)
</script>